@extends('admin.layout')
@push('style')

@endpush
@section('body')
    @if (\App\Facade\AppContext::can('index', 'analysis/home'))
        <div class="layui-fluid">
            <div class="layui-card">
                <div class="layui-card-body">
                    <div class="layui-tab">
                        <ul class="layui-tab-title">
                            <li class="layui-this">登记统计</li>
                            <li>预约统计</li>
                            <li>到诊统计</li>
                            <li>消费统计</li>
                        </ul>
                        <div class="layui-tab-content">
                            <div class="layui-tab-item layui-show">
                                <table class="layui-table" lay-even lay-skin="line" lay-size="sm">
                                    <tr>
                                        <th>来源渠道</th>
                                        <th>昨日登记</th>
                                        <th>今日登记</th>
                                        <th>上周登记</th>
                                        <th>本周登记</th>
                                        <th>上月登记</th>
                                        <th>本月登记</th>
                                    </tr>
                                    <tbody>
                                    @if(empty($tj['dj']))
                                        <tr>
                                            <td colspan="100">暂无数据</td>
                                        </tr>
                                    @else
                                        @foreach($tj['dj'] as $item)
                                            <tr>
                                                <th>{{$item['source_name']}}</th>
                                                <th>{{$item['yesterday']}}</th>
                                                <th>{{$item['today']}}</th>
                                                <th>{{$item['last_week']}}</th>
                                                <th>{{$item['week']}}</th>
                                                <th>{{$item['last_month']}}</th>
                                                <th>{{$item['month']}}</th>
                                            </tr>
                                        @endforeach
                                    @endif
                                    </tbody>
                                </table>
                            </div>
                            <div class="layui-tab-item">
                                <table class="layui-table" lay-even lay-skin="line" lay-size="sm">
                                    <tr>
                                        <th>来源渠道</th>
                                        <th>昨日预约</th>
                                        <th>今日预约</th>
                                        <th>上周预约</th>
                                        <th>本周预约</th>
                                        <th>上月预约</th>
                                        <th>本月预约</th>
                                    </tr>
                                    <tbody>
                                    @if(empty($tj['yy']))
                                        <tr>
                                            <td colspan="100">暂无数据</td>
                                        </tr>
                                    @else
                                        @foreach($tj['yy'] as $item)
                                            <tr>
                                                <th>{{$item['source_name']}}</th>
                                                <th>{{$item['yesterday']}}</th>
                                                <th>{{$item['today']}}</th>
                                                <th>{{$item['last_week']}}</th>
                                                <th>{{$item['week']}}</th>
                                                <th>{{$item['last_month']}}</th>
                                                <th>{{$item['month']}}</th>
                                            </tr>
                                        @endforeach
                                    @endif
                                    </tbody>
                                </table>
                            </div>
                            <div class="layui-tab-item">
                                <table class="layui-table" lay-even lay-skin="line" lay-size="sm">
                                    <tr>
                                        <th>来源渠道</th>
                                        <th>昨日到诊</th>
                                        <th>今日到诊</th>
                                        <th>上周到诊</th>
                                        <th>本周到诊</th>
                                        <th>上月到诊</th>
                                        <th>本月到诊</th>
                                    </tr>
                                    <tbody>
                                    @if(empty($tj['jz']))
                                        <tr>
                                            <td colspan="100">暂无数据</td>
                                        </tr>
                                    @else
                                        @foreach($tj['jz'] as $item)
                                            <tr>
                                                <th>{{$item['source_name']}}</th>
                                                <th>{{$item['yesterday']}}</th>
                                                <th>{{$item['today']}}</th>
                                                <th>{{$item['last_week']}}</th>
                                                <th>{{$item['week']}}</th>
                                                <th>{{$item['last_month']}}</th>
                                                <th>{{$item['month']}}</th>
                                            </tr>
                                        @endforeach
                                    @endif
                                    </tbody>
                                </table>
                            </div>
                            <div class="layui-tab-item">
                                <table class="layui-table" lay-even lay-skin="line" lay-size="sm">
                                    <tr>
                                        <th>来源渠道</th>
                                        <th>昨日消费</th>
                                        <th>今日消费</th>
                                        <th>上周消费</th>
                                        <th>本周消费</th>
                                        <th>上月消费</th>
                                        <th>本月消费</th>
                                    </tr>
                                    <tbody>
                                    @if(empty($tj['spend']))
                                        <tr>
                                            <td colspan="100">暂无数据</td>
                                        </tr>
                                    @else
                                        @foreach($tj['spend'] as $item)
                                            <tr>
                                                <th>{{$item['source_name']}}</th>
                                                <th>{{$item['yesterday']}}</th>
                                                <th>{{$item['today']}}</th>
                                                <th>{{$item['last_week']}}</th>
                                                <th>{{$item['week']}}</th>
                                                <th>{{$item['last_month']}}</th>
                                                <th>{{$item['month']}}</th>
                                            </tr>
                                        @endforeach
                                    @endif
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    @endif
@stop
@push('script')
    <script>
        //注意：选项卡 依赖 element 模块，否则无法进行功能性操作
        layui.use('element', function () {
            var element = layui.element;
        });
    </script>
@endpush